<template>
  <div class="content">
    <avue-form ref="form" v-model="obj" :option="option" @submit="submit">
    </avue-form>
  </div>
</template>

<script>
import { uploadUrl, post, get } from "@/api/base.js";
export default {
  name: "member",
  data() {
    return {
      obj: {
        privacy_description: "",
        about_us_description: "",
      },
      option: {
        submitText: "更新",
        emptyBtn: false,
        column: [
          {
            label: "关于我们",
            span: 24,
            options: {
              action: uploadUrl(),
            },
            type: "ueditor",
            prop: "about_us_description",
          },
          {
            label: "隐私说明",
            span: 24,
            options: {
              action: uploadUrl(),
            },
            type: "ueditor",
            prop: "privacy_description",
          },
        ],
      },
    };
  },
  created() {
    this.getData();
  },
  methods: {
    emptytChange() {
      this.obj = {
        privacy_description: "",
        about_us_description: "",
      };
    },
    submit(form, done) {
      post("sys-setting", form)
        .then((res) => {
          this.$message.success("更新成功");
          done();
        })
        .catch((err) => {
          console.log(err);
          done();
        });
    },
    getData() {
      get("sys-setting")
        .then((res) => {
          this.obj = res.data;
        })
        .catch((err) => {});
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  margin: 10px;
  padding: 10px;
}
</style>

